﻿Imports System.Windows.Forms

Public Class SuperCalendar
    Inherits MonthCalendar

    Private lastClickTick As Integer

    Public Shadows Event OnDoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Public Sub New()
        lastClickTick = Environment.TickCount - SystemInformation.DoubleClickTime
    End Sub

    Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
        Dim tick As Integer = Environment.TickCount
        If tick - lastClickTick <= SystemInformation.DoubleClickTime Then
            RaiseEvent OnDoubleClick(Me, EventArgs.Empty)
        Else
            MyBase.OnMouseDown(e)
            lastClickTick = tick
        End If
    End Sub

End Class
